package com.aizuda.boot.modules.business.contract.entity.vo;

import com.aizuda.boot.modules.system.entity.vo.UserAvatarVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @Author sangyirong
 * @ClassName ContractTypeDetailShowDto
 * @Version 1.0
 * @Date 2025/5/20 15:58
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "合同类型详情展示DTO")
public class ContractTypeDetailShowDTO {

    @Schema(description = "合同类型ID")
    private Integer id;

    @Schema(description = "父级合同类型ID，用于表示一级和二级，三级关系，NULL表示一级")
    private Integer parentId;

    @Schema(description = "父级合同类型名称")
    private String parentTypeName;

    @Schema(description = "合同类型名称")
    private String typeName;

    @Schema(description = "合同类型缩写")
    private String typeAbbreviation;

    @Schema(description = "合同类型说明")
    private String typeDescription;

    @Schema(description = "是否适用所有部门")
    private Boolean isAllDepartment;

    @Schema(description = "适用部门")
    private List<DepartmentInfo> applicableDepartments;

    @Schema(description = "是否不适用所有部门")
    private Boolean noAllDepartment; // 兼容旧字段，不再使用

    @Schema(description = "不适用部门（不再使用，固定空列表）")
    private List<DepartmentInfo> nonApplicableDepartments;

    @Schema(description = "是否启用该合同类型")
    private Boolean isEnabled;

    @Schema(description = "申请合同时是否可新增「对方」")
    private Boolean allowAddCounterparty;

    @Schema(description = "可用于创建（上传合同文件）")
    private Boolean canCreateUpload;

    @Schema(description = "可用于创建（使用合同模版）")
    private Boolean canCreateTemplate;

    @Schema(description = "可用于变更（补充协议）")
    private Boolean canChangeSupplement;

    @Schema(description = "可用于变更（修改表单）")
    private Boolean canChangeModifyForm;

    @Schema(description = "可用于终止（合同终止）")
    private Boolean canTerminateTermination;

    @Schema(description = "可用于终止（合同到期）")
    private Boolean canTerminateExpiry;

    @Schema(description = "可用于终止（作废）")
    private Boolean canTerminateVoid;

    @Schema(description = "合同类型排序")
    private Integer typeOrder;

    @Schema(description = "适用类型", examples = {"user", "department"})
    private String applicableType;

    @Schema(description = "适用用户")
    private List<UserAvatarVO> applicableUsers;

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "部门信息")
    public static class DepartmentInfo {
        @Schema(description = "部门ID")
        private Long id;
        
        @Schema(description = "部门名称")
        private String name;
    }
}
